<!DOCTYPE html>
<html lang="en">
<head>
	<{include file="user/header.html"}>
	<title>学员中心-德安信会计在线教育平台</title>
</head>
<body>
	<div class="wrap">
		<!--star left-->
		<div class="column">
			<{include file="user/left_menu.html"}>
		</div>
		<div id="ContMianBox">
			<!--star子栏目-->
			<div class="sub-colum">
				<div class="tit">班级管理</div>
				<ul>
					<li><a href="/user/learn_card">我的学习卡</a></li>
					<li class="curr"><a href="/user/learn_card/useing">激活学习卡</a></li>
				</ul>
			</div>
			<!--end子栏目-->
			<!--end left-->
			<div class="container narrow">
				<!--star conter-->
				<div class="cetContent">
					<div class="tit p-lr20">
						<span><a href="/user/learn_card">我的学习卡</a></span>
						<span class="curr">激活学习卡</span>
					</div>
					<!--star内容区域-->
					<div class="mainScroll">
						<div class="mainContainer line-all">
							<!--star tabMainCont-->

							<div class="layui-field-box">
								<form class="layui-form layui-form-pane" method="post" id="form_add_role">
									<div class="layui-form-item">
										<label class="layui-form-label">卡号：</label>
										<div class="layui-input-block">
											<input type="text" name="card_num" value="<{$news_info.title|default:''}>" lay-verify="required" autocomplete="off" class="layui-input">
										</div>
									</div>

									<div class="layui-form-item">
										<label class="layui-form-label">密码：</label>
										<div class="layui-input-block">
											<input type="text" name="card_pwd" value="<{$news_info.author|default:''}>" lay-verify="required" autocomplete="off" class="layui-input">
										</div>
									</div>


									<div class="layui-input-block">
										<button class="layui-btn" lay-submit lay-filter="*">立即激活</button>
									</div>
								</form>
							</div>
						</div>
						<!--end tabMainCont-->
					</div>
				</div>
			</div>
			<!--end内容区域-->

		</div>
		<div id="score_box" style="padding: 10px; display: none;">
			<div class="layui-form-item">
	            <div class="layui-inline">
					<input type="text" id="score" value="<{if !empty($conditions.name)}><{$conditions.name}><{/if}>" placeholder="分数" autocomplete="off" class="layui-input">
				</div>

	            <div class="layui-inline">
					<textarea placeholder="评语" id="content" style="width: 340px;" class="layui-textarea"><{if isset($learn_what)}><{$learn_what}><{/if}></textarea>
				</div>
	        </div>
	        <div class="layui-form-item">
	        	<div class="layui-inline">
					<button type="submit" id="sub_score" class="layui-btn">确定</button>
				</div>
	        </div>
		</div>
		<script>

		$(".score").click(function(){
            var _this = $(this);
            var teacher_id = $(this).attr("teacher_id");
            var class_id = $(this).attr("class_id");
            var index = layer.open({
		  		type: 1,
		  		resize: false,
			  	content: $('#score_box') //这里content是一个DOM，注意：最好该元素要存放在body最外层，否则可能被其它的相对元素所影响
			});
			// $("#score").val($(this).prev("span").html())

			$("#sub_score").click(function(){
				var score = $("#score").val();
				var content = $("#content").val();
				if(isNaN(score)){
	                layer.msg("必须是数字！", {icon:5, anim: 6});
	                return false;
	            }
	            if(score <= 0 || score > 100){
	            	layer.msg("评分必须大于1小于100", {icon:5, anim: 6});
	                return false;
	            }
				$.ajax({
                    type: "POST",
                    url: "/user/classes/update_score",
                    dataType:"json",
                    data:{'class_id':class_id, 'teacher_id':teacher_id, 'score':score, 'content':content},
                    success: function(result){
                        // layer.close(ii);
                        if(result.error == 0){
                        	layer.close(index)
                            layer.msg(result.msg, {icon:6});
                            _this.text(result.msg);
                            _this.prev("span").html(score);
                            // _this.unbind("click");
                        }else{
                            layer.msg(result.msg, {icon:5});
                        }
                    }
                });
			})
        })
	</script>
		<script>
			layui.use('laydate', function(){
			  var laydate = layui.laydate;

			  var start = {
			    min: '2016-11-31 23:59:59'
			    ,max: laydate.now(+1)
			    ,istoday: false
			    ,choose: function(datas){
			      end.min = datas; //开始日选好后，重置结束日的最小日期
			      end.start = datas //将结束日的初始值设定为开始日
			    }
			  };

			  var end = {
			    min: '2016-11-31 23:59:59'
			    ,max: laydate.now(+1)
			    ,istoday: false
			    ,choose: function(datas){
			      start.max = datas; //结束日选好后，重置开始日的最大日期
			    }
			  };

			  document.getElementById('LAY_demorange_s').onclick = function(){
			    start.elem = this;
			    laydate(start);
			  }
			  document.getElementById('LAY_demorange_e').onclick = function(){
			    end.elem = this
			    laydate(end);
			  }

			});
		</script>
	</div>
</body>
</html>